<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcCms.Data.PortalResource>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    MvcCms - <%=ViewData["PageTitle"]%>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
    <style type="text/css">
        label.error
        {
            color: #FF3300;
            font-weight: bold;
            font-size: large;
        }
    </style>
    <script type="text/javascript" src="/scripts/MvcCmsImageManager.js"></script>
    <script type="text/javascript" src="/scripts/ckeditor/ckeditor.js"></script>
    <script src="/scripts/ckeditor.js" type="text/javascript"></script>
    <link href="/content/ckeditor.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        var editor;
        function changeEnter() {
            // If we already have an editor, let's destroy it first.
            if (editor)
                editor.destroy(true);

            // Create the editor again, with the appropriate settings.
            editor = CKEDITOR.replace('Body',
		    {
		        enterMode: Number(1),
		        shiftEnterMode: Number(2),
		        height: "230"
		    });
            MvcCmsImages.SetupCKEditor(editor);
        }
        window.onload = changeEnter;
        //]]>
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="contentpage-outerdiv">
        <span class="field-validation-error">&nbsp;<%= Html.ValidationSummary("Edit was unsuccessful. Please correct the errors and try again.") %>
            <%=ViewData["message"].ToString()%>
        </span>
        <% using (Html.BeginForm("CreatePortalResource", "BackOffice", FormMethod.Post, new { id = "form1" }))
           {%>
        <fieldset>
            <legend>Create Portal Resource</legend>
            <div>
                <table width="100%">
                    <tr>
                        <td width="70%">
                            <p>
                                <label for="Title">
                                    Enter the text below to appear on this portal's resource:</label>
                                <%= ViewData["restype"]%>
                            </p>
                            <p>
                                <label for="Title">
                                    Body:</label>
                                <%= Html.TextArea("Body", "", new { @class = "mceEditor" })%>
                                <%= Html.ValidationMessage("Body", "")%>
                            </p>                       
                            <p>
                                <%=Html.Hidden("Portal.PortalID", ViewData["PortalID"])%>
                                <%=Html.Hidden("PortalResourceType.PortalResourceTypeID", ViewData["restypeid"])%>
                                <input type="submit" value="Save" />
                            </p>
                        </td>
                    </tr>
                </table>
            </div>
        </fieldset>
        <% } %>
        <div>
            <%=Html.ActionLink("Back to List", "ManagePortals") %>
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ScriptContent" runat="server">
    <script src="/Scripts/jquery.validate.min.js" type="text/javascript"></script>  
    <script type="text/javascript">
        $("#form1").validate({
            submitHandler: function(form) {
                form.submit();
            }
        });                
    </script>
</asp:Content>
